/*
 * Copyright (C) 2010-2011 Graz University of Technology, Austria. All Rights reserved. 
 *
 * Contact: Simone Kopeinik <simone.kopeinik@tugraz.at>
 * 	   Graz University of Technology, Knowledge Management Institute, Brückenkopfgasse 1/6, 8020 Graz 	
 * 	   <http://www.kmi.tugraz.at/>
 * 
 * This software is part of the TARGET platform developed by the
 * TARGET EC-funded project www.reachyourtarget.org
 *
 * This software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * The GNU General Public License is available at <http://www.gnu.org/licenses/>.
 *
 */
package at.tugraz.kmi.css.analyzer.gapvis;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import at.tugraz.kmi.css.analyzer.UserCompetence;

import com.google.common.collect.ImmutableSet;

/**
 * A Job Profile.
 * 
 * @author Georg Öttl <georg.oettl@gmail.com>
 * 
 */
public class JobProfile implements Serializable {
	/**
	 * 
	 */
	private static final long			serialVersionUID	= 1L;
	private final Set<UserCompetence>	competences;
	private final String				profileName;

	public JobProfile(String profileName) {
		competences = new HashSet<UserCompetence>();
		this.profileName = profileName;
	}

	public void addCompetence(UserCompetence c) {
		competences.add(c);
	}

	public Set<UserCompetence> getCompetences() {
		return ImmutableSet.copyOf(competences.iterator());
	}

	public String getProfileName() {
		return profileName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((profileName == null) ? 0 : profileName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		JobProfile other = (JobProfile) obj;
		if (profileName == null) {
			if (other.profileName != null) {
				return false;
			}
		} else if (!profileName.equals(other.profileName)) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return profileName;
	}

}
